]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Don't use substring to check prefix
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 5 Mar 2024 19:37:15 +0000 (20:37 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 19 Apr 2024 17:38:37 +0000 (17:38 +0000)
String.prototype.startsWith() is more idiomatic in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3234>

js/ui/notificationDaemon.js

index 71d8e6cc5da25608c438b86b7913fb1c7d4cdec5..ff4c26caf6651c02460d16c43209cc250b9cc0f5 100644 (file)
@@ -63,9 +63,9 @@ class FdoNotificationDaemon {
 
     _iconForNotificationData(icon) {
         if (icon) {
-            if (icon.substr(0, 7) === 'file://')
+            if (icon.startsWith('file://'))
                 return new Gio.FileIcon({file: Gio.File.new_for_uri(icon)});
-            else if (icon[0] === '/')
+            else if (icon.startsWith('/'))
                 return new Gio.FileIcon({file: Gio.File.new_for_path(icon)});
             else
                 return new Gio.ThemedIcon({name: icon});